/*
This is the master do file for the article:

Rauf et al. (2025). "An Audit Study of Social Science Survey Experiments"

Commands not in Official Stata needed for this to run:
-labmask-
-matsclrc- (package dm79.pkg)
-rforest-

To run the AllFilesCombineResults, please install the tess.ado, provided 
in the AnalysisStudies folder
*/

*******************************************************************************
*  PREPARE DATA FOR ANALYSIS
*******************************************************************************

* Analysis of TESS studies (needs tess.ado)
//do RunAllFilesCombineResults.do

*Combine raw files and clean variables (creates analysis data file)
do Makedata.do

*******************************************************************************
*  DESCRIPTIVE STATISTICS
*******************************************************************************

do Table1-SummaryStats.do

*******************************************************************************
* RESULTS: OVERALL RATE OF POSIITVE FINDINGS 
*******************************************************************************

do Results-OverallSuccessRates.do

*******************************************************************************
* RESULTS: WHAT PREDICTS SIGNIFICANT EXPERIMENTAL RESULTS?
*******************************************************************************

** figure: random forest analysis
do Figure1-RandomForest.do

** figure: probability of success by sample size at study and hypothesis levels
do Figure2-SampleSizeSuccess.do

*******************************************************************************
* RESULTS: WHY DOES SAMPLE SIZE MATTER?
*******************************************************************************

do Results-SampleSize.do

do Figure3-pvalueHistogram.do

*******************************************************************************
* RESULTS: MODERATION HYPOTHESES
*******************************************************************************

do Results-ModerationHypotheses.do

*******************************************************************************
* RESULTS: HOW MUCH DOES MEASUREMENT PRECISION HELP?
*******************************************************************************

do Results-MeasurementPrecision.do

*******************************************************************************
* RESULTS: DO PILOT STUDIES AND CHECKS IMPROVE SIGNIFICANCE RATES?
*******************************************************************************
 
do Results-PilotsChecks.do

*******************************************************************************
* RESULTS: DID SOME TYPES OF EXPERIMENTS WORK BETTER THAN OTHERS?
*******************************************************************************

do Results-ExperimentType.do

*******************************************************************************
* RESULTS: DO EXPERIENCE AND TRAINING MATTER?
*******************************************************************************

do Results-InvestigatorCharacteristics.do

do Figure4-InvestigatorCharacteristics.do

*******************************************************************************
* OTHER EMPIRICAL NOTES IN THE MANUSCRIPT
*******************************************************************************

do Notes.do

*******************************************************************************
* SUPPMENTARY MATERIAL
*******************************************************************************

* E1. Analyses without multiple testing correction

do SM-E11-Figure-RandomForest_nobonf.do 
do SM-E12-Figure-SamplesizeSuccess_nobonf.do
do SM-E13-Figure-InvestigatorCharacteristics_nobonf.do

* E2. Analyses of % of supported hypotheses in study

do SM-E21-Table-NumHypSuccess.do
do SM-E21-Figure-RandomForest_pctsupported.do
do SM-E22-Figure-SamplesizeSuccess_pctsupported.do
do SM-E23-Figure-InvestigatorCharacteristics_pctsupported.do

* F. Correlation Between Selected Study and Hypothesis Attributes

do SM-F1-Figure-CorrHeatplot_hyp.do
do SM-F2-Figure-CorrHeatplot_study.do
